package com.example.systemend.service.echartsImpl;

import org.apache.commons.lang3.time.DateUtils;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author 权哥
 * @version 1.0
 * @date 2022/6/7 11:34
 */
public class GetDay {
    public List<String> getSumDate(int sum) {

        List<String> SevenDateList = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        for (int i = 0; i < sum; i++) {

            Date date = DateUtils.addDays(new Date(), -i);
            String formatDate = sdf.format(date);
            SevenDateList.add(formatDate);
        }
        return SevenDateList;
    }

    public static void main(String[] args) {
        List<String> data = new GetDay().getSumDate(30);

        System.out.println(data);
    }

}
